class Solution {
public:
    bool isSubsequence(string s, string t) {
        size_t pre = 0;
        size_t des = 0;
        des = t.find_first_of(s);
        while (pre < s.size() && des != string::npos)
        {
            if (t[des] == s[pre])
            {
                pre++;
                des = t.find_first_of(s, des + 1);
            }
            else
            {
                des = t.find_first_of(s, des + 1);
            }
        }
        if (pre == s.size())
        {
            return true;
        }
        else {
            return false;
        }
    }
};